<?php
class Merchant_Service_Alert
{	
	public static $alertStatusArr = array(
        0 => 'Unread',	
        1 => 'Read',
    );
    
    public static $alertLevelArr = array(
        0 => 'Notice',	
        1 => 'Warning',
        2 => 'Important'
    );
	
	public function __construct(){
		
	}

	public function add($row){
		$Obj = new Merchant_Model_Alert();
		return $Obj->add($row);		
	}
	
	public function createAlert($title,$note,$type){
		$customerInfo = Merchant_Service_Customer::getLoginInfo();
		$customerId = $loginInfo->customer['customer_id'];
		if(!$customerId){ return 'NG'; }
		if($type){
			
		}elseif ($type){
			
		}
		$row = array();
		$row['customer_id'] = $customerId;
		$row['alert_status'] = 0;
		$row['alert_title'] = $title;
		$row['alert_note'] = $note;
		$row['alert_create_time'] = date('Y-m-d H:i:s');
				
		$Obj = new Merchant_Model_Alert();
		return $Obj->add($row);		
	}
	
	public function update($row,$value,$field){
		$Obj = new Merchant_Model_Alert();
		return $Obj->update($row,$value,$field);		
	}
	
	public function delete($value,$field){
		$Obj = new Merchant_Model_Alert();
		return $Obj->delete($value,$field);		
	}
	
	public function getByValue($value,$field){
		$Obj = new Merchant_Model_Alert();
		return $Obj->getByValue($value,$field);	
	}
	
	/**
	 * 根据条件获取指定信息
	 */
	public function getByCond($cond,$type,$order,$count,$offset){
		$Obj = new Merchant_Model_Alert();
		$rows = $Obj->getByCond($cond,$type,$order,$count,$offset);
		return $rows;		
	}	
	
}